home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1997 February
/
EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso
/
enigma
/
earcd
/
comm
/
comm5
/
adprotam.lha
/
adpro
/
ADPro_TAM
next >
Wrap
Text File
|
1997-01-07
|
7KB
|
232 lines
/*
* ADPro Transfer Anim arexx script
* $VER: ADPro_Transfer_Anim.rexx 0.75 1.7.9
* by Frank E Lahr © 1997 VTnt
*
* This script is a program and should be run from the icon
* instead of executing from ADPro as a macro/script.
* Otherwise it might cause crashes. OK?
* This rexx script will make a transfer anim for use
* with AWeb's browser. It takes a group of image files
* and makes them into a single delta file. It will also
* make the appropiate tooltypes in its icon from the aid
* of "c:ViewT" which was made by Phil Dietz.
*/
OPTIONS RESULTS
NL = '0A'X
SQ = '27'X
DQ = '22'X
TRUE = 1
FALSE = 0
icon = "env:sys/def_tool.info" /* Set variable to use this icon */
iconname = "def_tool" /* Set var name from previous icon */
destination = "CLIPS:" /* Set var path as to where to save the icon */
CALL Locate_ADPro
Address 'ADPro'
ADPRO_TO_FRONT
LFORMAT 'UNIVERSAL'
GETFILE '"LOAD FILE" "AWeb-II:storage/aweb-a_tam/mine" "new.01"'
IF RC ~= 0 THEN DO
say 'goodbye cruel world...'
EXIT
END
LFNAM = ADPRO_RESULT
LOAD LFnam
IF rc ~= 0 THEN DO
OKAY1 'Could Not Load' LFnam
EXIT
END
ELSE DO /* Get X & Y Size's of the image */
XSIZE
xsize = ADPRO_RESULT
YSIZE
ysize = ADPRO_RESULT
END
CALL getallimages
new_xsize = xsize * wdtotal
CALL makebg
say ' '
say 'The X = ' || xsize ||', Y = '|| ysize ||', Total Frames = '|| wdtotal
say 'The resolution of the transfer anim will be '|| new_xsize ||' by '|| ysize
CALL composite
CALL save
CALL makeicon
say ' '
say 'I hope you enjoyed my program :)'
ADDRESS COMMAND
'c:Delete RAM:adprolist.temp QUIET'
'c:Wait 2 SECS'
EXIT
/* *************************************************************** */
/* The sub routines */
/* *************************************************************** */
Locate_ADPro:
IF SHOW('P', 'ADPro') THEN
RETURN
ELSE
say 'AdPro not running, trying to start...'
ADDRESS COMMAND 'run >nil: ADPro:ADPro'
ADDRESS COMMAND 'c:wait 3 SECS'
call SHOW('P', 'ADPro')
IF rc = 5 THEN DO
say 'Unable to start ADPro'
EXIT
END
ELSE
RETURN
/* *********************************************************** */
/* Make a list of all the images in the sequence */
/* *********************************************************** */
getallimages :
finddot = lastpos('.',LFnam) /* Look for the '.' in image filepath */
IF finddot = "0" THEN DO
say 'The file you selected is not indexed correctly'
EXIT
END
ELSE
filelength = length(LFnam) /* How long is the filepath */
dot = lastpos('.', LFnam) -1 /* Find position of '.' in the filepath */
index = filelength - dot /* Do the math for the index offset */
fileindex = RIGHT(LFnam,index) /* Define the index from the filepath */
checkindex = VERIFY(fileindex,'.0123456789') /* Checks index to see if it's numeric */
IF checkindex ~= 0 THEN DO
say 'The file you selected is not indexed correctly with numbers'
EXIT
END
findslash = lastpos('/',LFnam) /* Look for the '/' in image filepath */
IF findslash = "0" THEN DO /* If '/' not there, */
findcolon = lastpos(':',LFnam) /* look for ':'. */
IF findcolon = "0" THEN EXIT
ELSE
colon = lastpos(':', LFnam) /* Find ':' in image filepath */
file = filelength - colon /* Do the math for the file offset */
filename = RIGHT(LFnam,file) /* Define the file from the filepath */
END
ELSE
slash = lastpos('/', LFnam) /* Find position of '/' in the filepath */
file = filelength - slash /* Do the math for the file offset */
filename = RIGHT(LFnam,file) /* Define the file from the filepath */
name = lastpos('.', filename) -1 /* Find position of '.' in filename */
justname = LEFT(filename,name) /* Define just name from filename */
path = LEFT(LFnam,slash) /* Defines the path from the filepath */
directory = path /* Sets directory path for requester */
/* next make a temp file of the image and associated indexed files to be called later */
ADDRESS COMMAND 'c:LIST 'path||justname||'#? TO RAM:adpro.temp NOHEAD QUICK'
IF rc ~= 0 THEN DO
RequestNotify 'Error listing image files.'
EXIT
END
/* sort alphabetically */
ADDRESS COMMAND 'c:Sort RAM:adpro.temp TO RAM:adprolist.temp'
ADDRESS COMMAND 'c:Delete RAM:adpro.temp QUIET'
/* Count the image files that are in the list */
wdtotal = 0
IF ~OPEN(infile, 'Ram:adprolist.temp', 'Read') THEN DO
RequestNotify 'Cannot read image files.'
END
ELSE
DO UNTIL EOF(infile)
wdtotal = wdtotal + Words(READLN(infile))
END
Close(infile)
RETURN
/* ************************************************** */
/* Make a background to composite the images onto */
/* ************************************************** */
makebg :
LFORMAT 'BACKDROP'
LOAD "XXX" new_xsize ysize "C"
IF RC ~= 0 THEN DO
OKAY1 'Could Not Load bg'
EXIT
END
return
/* ************************************************** */
/* Now composite all the image files */
/* ************************************************** */
composite :
LFORMAT 'UNIVERSAL'
Open(infile, 'Ram:adprolist.temp') /* Open list of image files */
say 'loading... please wait'
DO UNTIL EOF(infile)
imagefile = READLN(infile) /* Read image file */
fullfilepath = path||imagefile /* Add path to image file */
LOAD fullfilepath "0" "0" "100" "0" "0" "0" /* Load image file into Adpro */
If rc ~= 0 THEN
LEAVE
OPERATOR "ROLL" "LEFT" xsize
END
Close(infile) /* Close list of image files */
return
/* ************************************************** */
/* Now save the completed image file out */
/* ************************************************** */
save :
SFORMAT 'IFF'
GETFILE 'SAVE-FILE' 'AWeb-II:images' 'def_transferanim'
IF RC ~= 0 THEN DO
ADDRESS COMMAND 'c:Delete RAM:adprolist.temp QUIET'
say 'goodbye...'
EXIT
END
SFNAM = ADPRO_RESULT
SAVE SFnam Raw
IF RC ~= 0 THEN DO
OKAY1 'Could Not Save' SFnam
EXIT
END
return
/* *********************************************************** */
/* Make an icon with appropiate tooltypes with "c:viewt" */
/* *********************************************************** */
makeicon :
say 'making the icon...'
ADDRESS COMMAND
'c:copy 'icon' TO 'destination
'c:viewt 'destination||iconname' add "SIZE='xsize','ysize'"'
'c:viewt 'destination||iconname' add "FIRST=0,0"'
'c:viewt 'destination||iconname' add "FRAMES='wdtotal'"'
'c:viewt 'destination||iconname' add "DELTA='xsize',0"'
'c:viewt 'destination||iconname' add "REST=0,0"'
'c:copy 'destination||iconname'.info TO 'SFnam'.info'
'c:delete 'destination||iconname'.info QUIET'
return